Documenti disponibili
<%
dim fso,fldr,fl,wwwPth,startPth
startPath="Documenti" 'Indica, in relazione alla root del sito il percorso radice in cui reperire i documenti
'Restituisce il percorso fisico sul disco relativo alla cartella Documenti partendo dalla cadtella in cui si trova QUESTA pagina asp
wwwPth=Server.MapPath(startPath) & "/"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder(wwwPth & request.QueryString("sPth"))
%>
Documenti disponibili nella cartella <%=BuildLinks(request.QueryString("sPth"))%>Indietro
Nome
Ultima modifica
Dimensione
<%i=0%>
<%for each fl in fldr.SubFolders%>
<%if not fl.attributes and 6 then%>
<%if i mod 2 = 0 then bg="#DDDDDD" else bg="#CCCCCC" end if%>
<%i=i+1%>
<%end if%>
<%next%>
<%for each fl in fldr.files%>
<%if not fl.attributes and 6 then%>
<%if i mod 2 = 0 then bg="#DDDDDD" else bg="#CCCCCC" end if%>
Indietro
<%
Private function Ext2Img(sFile)
'Dato il nome di un file, restituisce, in base all'estensione,
'un tag img che punta all'immagine appropriata della cartella immagini
dim sExt,sImg,sRetVal
sExt=Fext(sFile)
'if sExt <> "" then
if InStr(ucase("xls|doc|rtf|eml|exe|ftp|htm|html|pdf|ppt|txt|zip"), ucase(sExt)) <> 0 then
sImg="ico_" & sExt & ".gif"
else
sImg="ico_.gif"
end if
Ext2Img=""
end function
%><%
Private Function Fext(sFile)
'Dato il nome di un file ne restituisce l'estensione, se presente,
'altrimenti una stringa vuota
dim sExt, iPos
iPos=InStrRev(sFile,".")
if iPos <> 0 then
sExt=Mid(Sfile,iPos+1)
else
sExt=""
end if
Fext=sExt
end function
%><%
Private Function BuildLinks(sPth)
'Data una stringa di percorso tipo Stampanti\Epson\C80
'restituisce una stringa equivalente, con i link attivi
dim aCartelle,sRetVal,sEle,sLink,i
sRetVal="Root"
if sPth <> "" then
sPth=Replace(sPth,"\","/")
aCartelle=Split(sPth,"/")
sLink=""
for i = 0 to Ubound(aCartelle)
if sLink <> "" then sLink = sLink & "/"
sLink=sLink & Server.URLEncode(aCartelle(i))
sRetVal=sRetVal & "" & aCartelle(i) & "/"
next
end if
BuildLinks=sRetVal
End Function
%>
<%
function DataIta(sDate)
dim svLocale,sRetVal
svLocale = GetLocale
SetLocale(1036) 'it-it:1040 fr-fr:1036
if IsNull(sDate) or sDate="" then
'sRetVal=Cdate(Date())
sRetVal=""
else
sRetVal=sDate
sRetVal=FormatDateTime(sRetVal,2) 'ShortDate
end if
SetLocale(svLocale)
DataIta=sRetVal
end function
%>
<%
function OraIta(sTime)
dim svLocale,sRetVal
svLocale = GetLocale
SetLocale(1036) 'it-it:1040 fr-fr:1036
if IsNull(sTime) or sTime="" then
'sRetVal=Cdate(Time())
sRetVal=""
else
sRetVal=sTime
sRetVal=FormatDateTime(sRetVal,3) 'LongTime
end if
SetLocale(svLocale)
OraIta=sRetVal
end function
%>
<%
function DataOraIta(sDateTime)
dim sRetVal
if IsNull(sDateTime) or sDateTime="" then
sRetVal=""
else
sRetVal=DataIta(sDateTime) & " " & OraIta(sDateTime)
end if
DataOraIta=sRetVal
end function
%>
<%
function NumRaggIta(sNumero) 'Data una stringa che contiene un numero intero restituisce una stringa con le cifre raggruppate
dim sRetVal,sDelim,sWrk
sDelim="."
sRetVal=""
'Se abbiamo un numero valido
if IsNull(sNumero) or sNumero="" or not IsNumeric(sNumero) then
sRetVal=""
else
sWrk=Trim(sNumero)
'Se il numero ha più di tre cifre
if Len(sWrk) > 3 then
'Finché sWrk é più lunga di tre
while Len(sWrk) > 3
'Aggiungiamo al valore di ritorno il delimitatore e le ultime tre
sRetVal=sDelim+Mid(sWrk,Len(sWrk)-2,3)+sRetVal
'Estraiamo da sWrk la parte già trattata
sWrk=Mid(sWrk,1,Len(sWrk)-3)
wend
'Aggiungiamo ciò che resta a sRetVal
sRetVal=sWrk + sRetVal
else
sRetVal=sWrk
end if
end if
NumRaggIta=sRetVal
end function
%>